﻿using System;
using System.Collections.Generic;
using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;

namespace Rodunu.Movies.Contracts
{
    public partial class UserInfo : IPrincipal, IIdentity
    {
        public virtual bool IsLoggedIn { get; set; }
        public virtual bool IsLoaded { get; set; }

        #region IPrincipal Members

        public virtual IIdentity Identity
        {
            get { return this; }
        }

        public virtual bool IsInRole(string role)
        {
            //foreach (AccessRight accessRight in Group.AccessRights)
            //{
            //    if (string.Compare(accessRight.Name, role) == 0)
            //    {
            //        return true;
            //    }
            //}


            return false;
        }

        #endregion

        #region IIdentity Members

        public virtual string AuthenticationType
        {
            get { return "Rodunu Authentication"; }
        }

        public virtual bool IsAuthenticated
        {
            get { return true; }
        }

        public virtual string Name
        {
            get { return UserName; }
        }

        #endregion
    }
}
